package com.caipin.controller;

/**
 * @Author: zhunian0322@163.com
 * @DateTime: 2021-09-30 9:25
 * @Description: TODO
 */
@RestController
@RequestMapping({"/homePageManagement"})
public class HomePageManagementController {
    @Autowired
    private HomePageManagementService homePageManagementService;

    @GetMapping({"/getPopulationSize"})
    Object populationSize() {
        PopulationCount populationCount = this.homePageManagementService.getPopulationSize();
        return ResultJson.ok(populationCount);
    }

    @GetMapping({"/numberOfPeopleTakingLeave"})
    Object numberOfPeopleTakingLeave() {
        List<LeaveInfo> leaveInfoList = new ArrayList<>();
        LeaveInfo leaveInfo1 = new LeaveInfo();
        LeaveInfo leaveInfo2 = new LeaveInfo();
        LeaveInfo leaveInfo3 = new LeaveInfo();
        LeaveInfo leaveInfo4 = new LeaveInfo();
        LeaveInfo leaveInfo5 = new LeaveInfo();
        LeaveInfo leaveInfo6 = new LeaveInfo();
        List<LeaveInfo.InfoBean> infoBeanList = new ArrayList<>();
        infoBeanList.add((new LeaveInfo.InfoBean()).setReason(").setNumber(1).setDescribe("));
        infoBeanList.add((new LeaveInfo.InfoBean()).setReason(").setNumber(2).setDescribe("));
        List<LeaveInfo.InfoBean> infoBeanList1 = new ArrayList<>();
        infoBeanList1.add((new LeaveInfo.InfoBean()).setReason(").setNumber(3).setDescribe("));
        infoBeanList1.add((new LeaveInfo.InfoBean()).setReason(").setNumber(4).setDescribe("));
        List<LeaveInfo.InfoBean> infoBeanList2 = new ArrayList<>();
        infoBeanList2.add((new LeaveInfo.InfoBean()).setReason(").setNumber(1).setDescribe("));
        List<LeaveInfo.InfoBean> infoBeanList3 = new ArrayList<>();
        infoBeanList3.add((new LeaveInfo.InfoBean()).setReason(").setNumber(5).setDescribe("));
        infoBeanList3.add((new LeaveInfo.InfoBean()).setReason(").setNumber(1).setDescribe("));
        List<LeaveInfo.InfoBean> infoBeanList4 = new ArrayList<>();
        infoBeanList4.add((new LeaveInfo.InfoBean()).setReason(").setNumber(6).setDescribe("));
        infoBeanList4.add((new LeaveInfo.InfoBean()).setReason(").setNumber(1).setDescribe("));
        List<LeaveInfo.InfoBean> infoBeanList5 = new ArrayList<>();
        infoBeanList5.add((new LeaveInfo.InfoBean()).setReason(").setNumber(10).setDescribe("));
        leaveInfo1.setGrade(").setClassX(").setTotal(3).setInfo(infoBeanList);
        leaveInfo2.setGrade(").setClassX(").setTotal(7).setInfo(infoBeanList1);
        leaveInfo3.setGrade(").setClassX(").setTotal(1).setInfo(infoBeanList2);
        leaveInfo4.setGrade(").setClassX(").setTotal(6).setInfo(infoBeanList3);
        leaveInfo5.setGrade(").setClassX(").setTotal(7).setInfo(infoBeanList4);
        leaveInfo6.setGrade(").setClassX(").setTotal(10).setInfo(infoBeanList5);
        leaveInfoList.add(leaveInfo1);
        leaveInfoList.add(leaveInfo2);
        leaveInfoList.add(leaveInfo3);
        leaveInfoList.add(leaveInfo4);
        leaveInfoList.add(leaveInfo5);
        leaveInfoList.add(leaveInfo6);
        return ResultJson.ok(leaveInfoList);
    }

    @GetMapping({"/numberOfPeopleTakingTemperature"})
    Object getNumberOfPeopleTakingTemperature() {
        TemperatureInfo temperatureInfo = this.homePageManagementService.getTemperatureInfo();
        return ResultJson.ok(temperatureInfo);
    }

    @GetMapping({"/numberOfPeopleTakingIn"})
    Object getNumberOfPeopleTakingIn(@RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
        List<InAndOutInfo> inAndOutInfoList = this.homePageManagementService.getNumberOfPeopleTakingIn(startDate, endDate);
        return ResultJson.ok(inAndOutInfoList);
    }

    @GetMapping({"/numberOfPeopleTakingVisitRotationChart"})
    Object getNumberOfPeopleTakingVisitRotationChart() {
        List<VisitInfo> visitInfoList = this.homePageManagementService.getNumberOfPeopleTakingVisitRotationChart();
        List<Object> list = new ArrayList();
        list.add(visitInfoList);
        return ResultJson.ok(list);
    }

    @GetMapping({"/numberOfPeopleTakingClassroom"})
    Object getNumberOfPeopleTakingClassroom(@RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
        List<ClassroomEvent> classroomEventList = this.homePageManagementService.getNumberOfPeopleTakingClassroom(startDate, endDate);
        if (classroomEventList == null)
            return ResultJson.failure(ResultCode.BAD_REQUEST);
        return ResultJson.ok(classroomEventList);
    }

    @GetMapping({"/numberOfPeopleTakingVisitCount"})
    Object getNumberOfPeopleTakingVisitCount() {
        Map<Object, Object> map = new HashMap<>();
        map.put("yesterday", Integer.valueOf(780));
        map.put("today", Integer.valueOf(900));
        return ResultJson.ok(map);
    }

    @GetMapping({"/numberOfPeopleTakingHeatMap"})
    Object getNumberOfPeopleTakingHeatMap() {
        List<Object> list = new ArrayList();
        list.add(new PersonnelDistribution(", 100));
                list.add(new PersonnelDistribution(", 400));
                        list.add(new PersonnelDistribution(", 700));
        return ResultJson.ok(list);
    }

    @GetMapping({"/canteenDressWarning"})
    Object getCanteenDressWarning(@RequestParam("count") Integer count) {
        List<CanteenDressWarning> canteenDressWarningList = new ArrayList<>();
        for (int i = 0; i < count.intValue(); i++)
            canteenDressWarningList.add(new CanteenDressWarning("2020-10-03 12:30:20", ", "));
        return ResultJson.ok(canteenDressWarningList);
    }

    @GetMapping({"/realtimeReportOfBodyTemperature"})
    Object getRealtimeReportOfBodyTemperature(@RequestParam("count") Integer count) {
        List<BodyTemperatureReport> bodyTemperatureReportList = this.homePageManagementService.getRealtimeReportOfBodyTemperature(count);
        return ResultJson.ok(bodyTemperatureReportList);
    }

    @GetMapping({"/panoramaCapturedByStrangers"})
    Object getPanoramaCapturedByStrangers(@RequestParam("parentId") Long parentId) {
        String imageSrc = this.homePageManagementService.getPanoramaCapturedByStrangers(parentId);
        return ResultJson.ok(imageSrc);
    }
}

